<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" session="false"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
    <title>部门员工绩效</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <link rel="stylesheet" type="text/css" href="../../css/workflow/m_reset.css">
    <link rel="stylesheet" type="text/css" href="../../css/workflow/work/workMonitor.css">
    <link rel="stylesheet" href="../../css/officialDocument/officialDocument.css">
    <link rel="stylesheet" type="text/css" href="../../lib/pagination/style/pagination.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/base.css" />
    <link rel="stylesheet" type="text/css" href="/css/base/base.css?20201106.1" />
    <link rel="stylesheet" href="/lib/layer/skin/default/layer.css">
    <link rel="stylesheet" type="text/css" href="../../css/workflow/work/handle.css"/>
    <script type="text/javascript" src="/js/jquery/jquery-1.9.1.js"></script>
    <script type="text/javascript" src="/js/base/tablePage.js"></script>
    <script src="/lib/layer/layer.js?20201106"></script>
    <script src="/js/base/base.js"></script>
    <script src="../../lib/pagination/js/jquery.pagination.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="../../js/jquery/jquery.cookie.js"></script>
    <meta name="viewport" content="width=device-width, initial-scale=1">
</head>

<body class="body-sticky">
<form id="form1" action="" method="post" target="myFrame">
</form>
<iframe style="width:100%;height:100%;border:0px;margin:0px;padding:0px;" id="myFrame" name="myFrame" src=""></iframe>
<script>
    var userId = "";
    var deptId = "";
    var userPriv = "";
    var company = "";
    $(function(){
        $.ajax({
            url: '/getLoginUser',
            type: 'GET',
            dataType: 'json',
            async: false,
            success: function(res){
                userId = res.object.userId;
                deptId = res.object.deptId;
                userPriv = res.objectuserPrivName;
                company = res.object.companyName;
                /*
                alert(userId);
                $("#form1").attr("action","http://10.191.15.57:8075/webroot/decision/view/report?viewlet=flow%252F%25E6%2580%25BB%25E9%2583%25A8%25E6%25B5%2581%25E7%25A8%258B%25E6%2597%25B6%25E6%2595%2588%25E5%25B1%2595%25E7%25A4%25BA%25E9%25A1%25B5%25E9%259D%25A2.cpt&op=write&userid="+userId+
                "&deptid="+deptId+"&userpriv="+userPriv+"&conpamy="+company);
                $("#form1").submit();
                */
                gotoUrl();
            }
        })
    })
    function gotoUrl() {
        $.ajax({
            url: '/department/getDeptById',
            type: 'GET',
            data:{deptId:deptId},
            dataType: 'json',
            async: false,
            success: function(obj){
                var deptManager = obj.object.manager;
                var manager = deptManager.substring(deptManager.lastIndexOf("&")+1,deptManager.length-1);
                //alert(manager);
                if (manager!=""){
                    if(manager == userId){
                        $("#form1").attr("action","http://10.191.15.57:8075/webroot/decision/view/report?viewlet=flow%252F%25E8%2580%2583%25E6%25A0%25B8%25E6%258A%25A5%25E5%2591%258A%2528%25E9%2583%25A8%25E9%2597%25A8%2529.cpt&op=write&userid="+userId+
                            "&deptid="+deptId);
                        $("#form1").submit();
                    }
                    else{
                        alert("抱歉，您无权查看...");
                        /*
                         $("#form1").attr("action","http://10.191.15.57:8075/webroot/decision/view/report?viewlet=flow%252F%25E6%2580%25BB%25E9%2583%25A8%25E6%25B5%2581%25E7%25A8%258B%25E6%2597%25B6%25E6%2595%2588%25E5%25B1%2595%25E7%25A4%25BA%25E9%25A1%25B5%25E9%259D%25A2.cpt&op=write&userid="+userId+
                             "&deptid="+deptId+"&userpriv="+userPriv+"&conpamy="+company);
                        */
                    }
                }

            }
        })
    }
</script>
</body>
</html>